package com.ces.hk.hibernate.dao.Impl;

import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.SessionFactory;

import com.ces.hk.hibernate.dao.UserDao;
import com.ces.hk.hibernate.model.User;

public class UserdaoImpl implements UserDao {
	static SessionFactory factory;

	public SessionFactory getFactory() {
		return factory;
	}

	public void setFactory(SessionFactory factory) {
		this.factory = factory;
	}

	public static Session session;

		
	

	@Override
	public int insert(User user) {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public int countAll() {
		session = factory.openSession();
		session.beginTransaction();
		String hql="from User t_student";
		Query query=session.createQuery(hql);
		return query.list().size();
		
	}

	@Override
	public int findId(String name) {
		// TODO Auto-generated method stub
		return 0;
	}

}
